<template>
  <div id="app" v-bind:style="appDivStyle">
      <div class="context" ref="context">
          <!-- 条件查询区 -->
           <div class="queryBox" ref="queryBox">
                <el-form :model="formQueryCondition"
                         ref="form" size="mini">
                    <el-row>
                        <!-- 剧集编号 -->
                        <el-col :span="5">
                            <el-form-item :label="$t('assetsAudit.subAssets.subAssetCode')"   :label-width="queryformLabelWidth">
                                <el-input v-model.trim="formQueryCondition.subassetCode.val" class="queryItemStyle" clearable
                                        :placeholder="$t('assetsAudit.subAssets.placeholderSubAssetCode')">
                                </el-input>
                            </el-form-item>
                        </el-col>
                        <!-- 剧集名称 -->
                        <el-col :span="5" :offset="1">
                            <el-form-item :label="$t('assetsAudit.subAssets.subAssetName')"   :label-width="queryformLabelWidth">
                                <el-input v-model.trim="formQueryCondition.subassetName.val" class="queryItemStyle" clearable
                                        :placeholder="$t('assetsAudit.subAssets.placeholderSubAssetName')">
                                </el-input>
                            </el-form-item>
                        </el-col>
                        <!-- 审核时间起 -->
                        <el-col :span="5" :offset="1">
                            <el-form-item :label="$t('assetsAudit.auditTime')" :label-width="queryformLabelWidth">
                                <el-date-picker v-model.trim="formQueryCondition.auditTimeS.val" class="queryItemStyle" clearable
                                        :placeholder="$t('queryLabel.selectOp')" type="date" >
                                </el-date-picker>
                            </el-form-item>
                        </el-col>
                        <!-- 审核时间止 -->
                        <el-col :span="5" :offset="1">
                            <el-form-item :label="$t('queryLabel.timeTo')" :label-width="queryformLabelWidth">
                                <el-date-picker v-model.trim="formQueryCondition.auditTimeE.val" class="queryItemStyle" clearable
                                                value-format="yyyy-MM-dd 23:59:59"
                                        :placeholder="$t('queryLabel.selectOp')" type="date" >
                                </el-date-picker>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <el-row>
                        <!-- 来源 -->
                        <el-col :span="5">
                            <el-form-item :label="$t('queryLabel.subAssets.source')" :label-width="queryformLabelWidth">
                                <el-select v-model.trim="formQueryCondition.source.val" class="queryItemStyle" :placeholder="$t('queryLabel.selectOp')">
                                    <el-option :label="$t('shellAssets.label.all')" value=""></el-option>
                                    <el-option :value="item.keyId" :key="item.keyId" :label="item.speAreaName" v-for="item in assetSourceData"></el-option>
                                </el-select>
                            </el-form-item>
                        </el-col>
                    </el-row>
                    <!-- <el-form-item :label="$t('queryLabel.subAssets.status')" :label-width="queryformLabelWidth">
                        <el-select v-model.trim="formQueryCondition.status.val" class="queryItemStyle" :placeholder="$t('queryLabel.selectOp')">
                            <el-option :label="$t('shellAssets.label.all')" value=""></el-option>
                            <el-option :value="item.valueCode" :key="item.valueCode" :label="item.valueText" v-for="item in approvalStatusData"></el-option>
                        </el-select>
                    </el-form-item> -->
                    <el-row>
                        <el-col :span="24">
                            <div style="text-align:right">
                                <el-form-item v-if="isNeedGoBack">
                                    <!-- 返回 -->
                                    <el-button type="primary" @click="onBack('form')" icon="el-icon-back">{{ $t('btnText.backBtnText') }}</el-button>
                                <!-- </el-form-item> -->
                                <!-- <el-form-item> -->
                                    <!-- 重置 -->
                                    <el-button v-permission="{menuCode: menuCode, resourceCode: 'resetAssetBtnText'}"
                                    type="primary" @click="onReset('form')">{{ $t('btnText.resetBtnText') }}</el-button>
                                <!-- </el-form-item> -->
                                <!-- <el-form-item> -->
                                    <el-button v-permission="{menuCode: menuCode, resourceCode: 'batchAuditBtnText'}"
                                    type="primary" @click="onBatchAudit('batchAuditBtnText')" icon="el-icon-edit" :loading="loading">{{ $t('btnText.batchAuditBtnText') }}</el-button>
                                    <!-- 查询 -->
                                    <el-button v-permission="{menuCode: menuCode, resourceCode: 'queryAssetBtnText'}"
                                    type="primary" @click="onQuery('queryAssetBtnText')" icon="el-icon-search" :loading="loading">{{ $t('btnText.queryBtnText') }}</el-button>
                                <!-- </el-form-item> -->
                                <!--
                                <el-form-item>
                                    <el-button type="primary" @click="onRecord" icon="el-icon-document" :loading="loading">{{ $t('btnText.auditRecordBtnText') }}</el-button>
                                </el-form-item>
                                -->
                                <!-- <el-form-item>
                                    <el-button type="primary" @click="onScreenShot" icon="el-icon-picture" :loading="loading">{{ $t('btnText.lookScreenShotBtnText') }}</el-button>
                                </el-form-item> -->
                                <!-- <el-form-item> -->
                                    <!-- 批量审核 -->
                                    </el-form-item>
                            </div>
                        </el-col>
                    </el-row>
                </el-form>
            </div>

            <!-- 数据展示区 -->
            <div class="dataBox" ref="dataBox">

                <el-table v-if="isInit" ref="singleTable"
                            :data="tableData"
                            :height="tableHeight"
                            @sort-change="sortChange"
                            v-loading="loading" size="mini"
                            style="width: 100%;" stripe=stripe border=border
                            @selection-change="changeBox">
                    <!-- <el-table-column type="index"  width="70" fixed="left"
                        :label="$t('table.xh')" align="center">
                    </el-table-column> :selectable='checkboxInit' -->
                    <el-table-column type="selection" width="55" fixed="left" align="center" :selectable='checkboxInit'>
                    </el-table-column>
                    <el-table-column width="180" fixed="left"
                        :label="$t('table.op')" align="center">
                        <template slot-scope="scope">
                            <el-button size="gv" icon="el-icon-tickets"
                                :loading="loading" @click="onDetails(scope.$index, scope.row,'detailsAssetBtnText')"
                                v-permission="{menuCode: menuCode, resourceCode: 'detailsAssetBtnText'}"
                                    >{{ $t('assetsAudit.btnText.detailsBtnText') }}</el-button>
                            <el-button size="gv" icon="el-icon-caret-right"
                            v-permission="{menuCode: menuCode, resourceCode: 'previewBtnText'}"
                                :loading="loading" @click="onPlay(scope.$index, scope.row,'previewBtnText')"
                                    >{{ $t('assetsAudit.btnText.previewBtnText') }}</el-button>
                        </template>
                    </el-table-column>
                    <el-table-column prop="subassetCode" min-width="120" fixed="left"
                        :label="$t('assetsAudit.subAssets.subAssetCode')" sortable="custom" sort-by="subassetCode">
                    </el-table-column>
                    <el-table-column prop="subassetName" min-width="180" fixed="left"
                        :label="$t('assetsAudit.subAssets.subAssetName')" sortable="custom" sort-by="subassetName">
                    </el-table-column>
                    <el-table-column prop="assetType" min-width="110" sortable="custom" sort-by="assetType"
                        :label="$t('assetsAudit.subAssetsInfo.type')" >
                    </el-table-column>
                    <!-- sortable="custom" sort-by="assetEntity.assetSpeArea.speAreaName" -->
                    <el-table-column prop="speAreaName" min-width="110"
                        :label="$t('table.assetsAudit.source')" >
                    </el-table-column>
                    <el-table-column prop="subassetNum" min-width="110"
                        :label="$t('assetsAudit.subAssetsInfo.itemNum')" sortable="custom" sort-by="subassetNum">
                    </el-table-column>
                    <!-- <el-table-column prop="definition" min-width="110"
                        :label="$t('assetsAudit.subAssetsInfo.definition')" sortable="custom" sort-by="code">
                    </el-table-column> -->
                    <el-table-column prop="approvalStatus" min-width="110"
                        :label="$t('assetsAudit.subAssetsInfo.status')" sortable="custom" sort-by="approvalStatus">
                    </el-table-column>
                    <el-table-column prop="lastUpdatedDate" min-width="140"
                        :label="$t('assetsAudit.subAssetsInfo.auditTime')" sortable="custom" sort-by="lastUpdatedDate">
                    </el-table-column>
                </el-table>


            </div>
        </div>

        <!-- 翻页选择区 -->
        <div class="pageBox">
            <el-pagination @size-change="sizeChange"
                            @current-change="currentPageChange"
                            :current-page="pager.curPage"
                            :page-sizes="pager.sizes"
                            :page-size="pager.curSize"
                            :background="true"
                            layout="total, sizes, prev, pager, next, jumper" :total="pager.total">
            </el-pagination>
        </div>

         <!--详情对话框-->
        <el-dialog :title="$t('label.dialogDetails')" :visible.sync="isShowInfoForm" top="5vh" width="60%" @close="renewRecord" :close-on-click-modal="false">
          <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
            <el-tab-pane :label="$t('assetsAudit.subAssets.details')" name="first">
                    <subAssets-info :datas="dataForm"></subAssets-info>
            </el-tab-pane>
            <!-- <el-tab-pane :label="$t('assetsAudit.auditRecord')" name="second">
                    <audit-record :datas="reviewQueryCondition" ref="auditRecord"></audit-record>
            </el-tab-pane> -->
            </el-tabs>
        </el-dialog>



         <!--批量审核对话框-->
        <el-dialog :title="$t('assetsAudit.auditing')" :visible.sync="isShowEditForm" @close="closeDialog" top="5vh" width="60%" :close-on-click-modal="false">
            <el-form :model="editForm" ref="editForm" size="mini"
                     :label-position="editFormPosition" status-icon=status-icon :rules="editRules">
                <el-form-item :label="$t('assetsAudit.auditSuggestion')" :label-width="editformLabelWidth" prop="reviewDesc">
                    <el-input v-model.trim="editForm.reviewDesc" type="textarea" :rows="2"  :placeholder="$t('label.pleaseInput')">></el-input>
                </el-form-item>
                <el-form-item  :label-width="editformLabelWidth" >
                    <el-button size="mini" type="primary"  @click="submitFormForPass(currentResCode)" :loading="loading">{{$t('assetsAudit.pass')}}</el-button>
                    <el-button size="mini" type="primary"  @click="submitFormForReject('editForm',currentResCode)" :loading="loading">{{$t('assetsAudit.reject')}}</el-button>
                    <el-button size="mini" type="primary"  @click="submitFormForDiscard('editForm')" :loading="loading">{{$t('assetsAudit.discard')}}</el-button>
                    <el-button size="mini" @click="isShowEditForm = false" :loading="loading">{{ $t('btnText.cancelBtnText') }}</el-button>
                </el-form-item>
             </el-form>
        </el-dialog>

  </div>


</template>

<script>

import comBaseVue from '../../baseViewModel';
import subAssetsInfo from './SubAssetsInfo';
import auditRecord from  './AuditRecord';

export default {
  mixins: [comBaseVue],
  name:'SubAssets',
  props: {
    isNeedGoBack:Boolean,
    // curRootAssets: Object,
    curProps: null,
    menuCode: String,
  },
  data () {

    return {
        isShowInfoForm: false,
        activeName: 'first',
        isInit:false,
        tableHeight:100,
        multipleSelection: [],
        assetSourceData:[],
        approvalStatusData:[],
        appDivStyle:{
            height:this.$store.getters.appHeight,
        },
        parentToValue:"",
        modelName:"com.ispr.iptv.entity.media.SubAssetEntity",
        // 排序对象
        sort: {
            key: "subassetNum",
            dir: "Desc"
        },
        // 查询条件
        formQueryCondition: {
            assetCode: {
                key: 'assetId',
                op: '=',
                val: "",
            },
            subassetCode: {
                key: 'subassetCode',
                op: 'LIKE',
                val: ''
            },
            subassetName: {
                key: 'subassetName',
                op: 'LIKE', // 操作符
                val: '' // 查询的值
            },
            auditor: {
                key: 'auditor',
                op: 'LIKE', // 操作符
                val: '' // 查询的值
            },
            assetType: {
                key: 'assetType',
                op: 'LIKE', // 操作符
                val: '' // 查询的值
            },
            // updateTimeS: {
            //     key: 'isEnable',
            //     op: 'LIKE', // 操作符
            //     val: '' // 查询的值
            // },
            // updateTimeE: {
            //     key: 'isEnable',
            //     op: 'LIKE', // 操作符
            //     val: '' // 查询的值
            // },
            auditTimeS: {
                key: 'lastUpdatedDate', // 操作符
                group: 'auditTimeS',
                op: '>=', // 操作符
                val: '' // 查询的值
            },
            auditTimeE: {
                key: 'lastUpdatedDate', // 操作符
                group: 'auditTimeE',
                op: '<=', // 操作符
                val: '' // 查询的值
            },
            source: {
                key: 'assetSource', // 操作符
                op: '=', // 操作符
                val: '' // 查询的值
            },
            status: {
                key: 'approvalStatus', // 操作符
                op: '=', // 操作符
                val: 'PendingReview' // 查询的值
            },
            isEnable: {
                key: 'isEnable', // 操作符
                op: '=', // 操作符
                val: 'Available' // 查询的值
            },
        },

         // 编辑面板(审核)绑定的对象
        editForm: {
            keyId: "",
            version: 0,//审核记录表新增记录的version
            subAssetVersion: "",//当前审核剧集的version
            reviewDataId: "",
            reviewDataType: "",
            isEnable: "",

            approvalStatus: "",
            reviewDesc: "",
        },
        // 编辑面板(审核)的验证规则
        editRules: {
            reviewDesc: [{ validator:this.validateRe, message: this.$i18n.t('assetsAudit.rules.auditSuggestion'), trigger: 'blur' }],
        },
         dataForm: {
            keyID: 0,
            version: 0,
            belongToAssets: "",
            subAssetName: "",
            itemNum: "",
            time: "",
            definition:"",
            resolution:"",
            codeRate:"",
            videoSize:"",
            originId:"",
            absoluteURL:"",
            // belongToAssets: "致命追击",
            // subAssetName: "致命追击",
            // itemNum: "1",
            // time: "90分钟",
            // definition:"是",
            // resolution:"1920*1080",
            // codeRate:"1300kbps",
            // videoSize:"1.5G",
            // originId:"121329_10503",
            // absoluteURL:"http://www.haikan.com",
        },
        reviewQueryCondition: {
            code: {
                key: 'reviewDataId',
                op: '=', // 操作符
                val: ''
            },
            type: {
                key: 'reviewDataType',
                op: '=', // 操作符
                val: ''
            },
            assetName: {
                key: 'subassetName',
                op: '=',
                val: ''
            },

        },
        isPass:'pass'

    }
  },
  methods:{
      validateRe(rule, value,callback){
          if(this.editForm.approvalStatus==='ExaminationPassed'){
              callback()
          }else{
              callback(new Error('请输入审核意见'));
          }
      },
     // 查询按钮
    onQuery: function(rescode) {
      this.currentResCode = (rescode && rescode!=='') ? rescode : '';
        if(this.formQueryCondition.auditTimeS.val!=null
        && this.formQueryCondition.auditTimeS.val!=""){
            this.formQueryCondition.auditTimeS.val=this.formatDate(this.formQueryCondition.auditTimeS.val);
        }
        if(this.formQueryCondition.auditTimeE.val!=null
        && this.formQueryCondition.auditTimeE.val!=""){
            this.formQueryCondition.auditTimeE.val=this.formatDate(this.formQueryCondition.auditTimeE.val);
        }
        this.pager.curPage = 1;
        this.queryTable();
    },

     // 查询网格数据
    queryTable: function() {
        this.loading = true;
        this.auditConfirmQuery("/api/subAsset/selectPage",this.modelName,"Query",this.formQueryCondition,this.pager,this.sort,this.setTableData)
    },

     // 网格数据成功后的回调
    setTableData: function(isSuccess,json) {
        this.loading = false;
        // console.log(json);
        try{
            if (isSuccess) {
                //alert(JSON.stringify(json));
                this.pager.total = json.total;
                this.tableData = [];
                for (var i = 0; i < json.list.length; i++) {
                    this.tableData.push(json.list[i]);
                }

            }
            else {
                this.$message.error(json.msg);
            }
        }
        catch(e){
            alert(e);
        }
    },

     // 重置
    onReset:function(){
        if (this.$refs['form']) {
            this.$refs['form'].resetFields();
        }
        this.formQueryCondition.subassetCode.val = "";
        this.formQueryCondition.subassetName.val = "";
        this.formQueryCondition.auditor.val = "";
        this.formQueryCondition.assetType.val = "";
        // this.formQueryCondition.updateTimeS.val = "";
        // this.formQueryCondition.updateTimeE.val = "";
        this.formQueryCondition.auditTimeS.val = "";
        this.formQueryCondition.auditTimeE.val = "";
        this.formQueryCondition.source.val = "";
        this.formQueryCondition.status.val = "PendingReview";
    },

    tableRowClassName({row, rowIndex}) {
        if (rowIndex === 1) {
          return 'warning-row';
        } else if (rowIndex === 3) {
          return 'success-row';
        }
        return '';
    },

    // 授权按钮单击事件
    editMenu: function(index, row) {

    },

    //查看截图
    onScreenShot: function() {

    },

    //批量审核
    onBatchAudit: function(rescode) {
        this.currentResCode = (rescode && rescode!=='') ? rescode : '';
        if(this.multipleSelection.length==0){
            this.$message({
                message: this.$i18n.t("assetsAudit.subAssets.checkTip"),
                type: 'warning'
            });
            return;
        }
        this.editForm.reviewDesc = "";
        // this.editForm.assetVersion = row.version;
        // this.editForm.reviewDataId= row.keyId,
        this.editForm.reviewDataType= "SUBASSET",
        this.editForm.isEnable= "Available",
        this.isShowEditForm = true;
    },
    // 通过
    submitFormForPass: function (rescode) {
      this.currentResCode = (rescode && rescode!=='') ? rescode : '';
        this.editForm.approvalStatus= "ExaminationPassed",
        this.loading = true;
        
        this.procCommand("MediaAuditProc","com.ispr.iptv.entity.media.SubAssetEntity","Default",
        {
            // "keyId":this.editForm.reviewDataId,
            // "version":this.editForm.subAssetVersion,
            "assetId":this.curProps,
            "approvalStatus":this.editForm.approvalStatus,
            "reviewHisEntity":this.editForm,
            "dataList":this.multipleSelection,
        },null,this.commonCallback);
    },
    //  驳回
    submitFormForReject: function (formName,rescode) {
      this.currentResCode = (rescode && rescode!=='') ? rescode : '';
    var _this = this;
    this.editForm.approvalStatus= "TheAuditFailed",
    this.$refs[formName].validate(function (valid) {
            if (valid) {
                _this.loading = true;
                    
                    _this.procCommand("MediaAuditProc","com.ispr.iptv.entity.media.SubAssetEntity","Default",
                    {
                        // "keyId":this.editForm.reviewDataId,
                        // "version":this.editForm.subAssetVersion,
                        "assetId":_this.curProps,
                        "approvalStatus":_this.editForm.approvalStatus,
                        "reviewHisEntity":_this.editForm,
                        "dataList":_this.multipleSelection,
                    },null,_this.commonCallback);
            } else {
                return false;
            }
        });
    },

    //废弃
    submitFormForDiscard: function(formName){
      var _this = this;
        this.editForm.approvalStatus= "Discard",
    this.$refs[formName].validate(function (valid) {
            if (valid) {
        _this.loading = true;
        _this.procCommand("MediaAuditProc",
        "com.ispr.iptv.entity.media.SubAssetEntity",
        "Default",
        {
            // "keyId":this.editForm.reviewDataId,
            // "version":this.editForm.assetVersion,
            "assetId":_this.curProps,
            "approvalStatus":_this.editForm.approvalStatus,
            "reviewHisEntity":_this.editForm,
            "dataList":_this.multipleSelection,
        },
        null,
        _this.commonCallback);
    }else {
                return false;
            }
    });
    },

    closeDialog: function(){
        this.$refs['editForm'].resetFields();
    },
    commonCallback: function (isSuccess,json) {
        this.loading = false;
        this.isShowEditForm = false;
        if(isSuccess){
            this.$message({
                message: this.$i18n.t("message.successTip"),//resource.message.successTip,
                type: 'success'
            });
            this.queryTable();
        }
        else
        {
            this.$message({
                            message: json.reason,
                            type: 'warning'
                            });
        }
    },
     // 返回主页
    // onBack: function(isSuccess, json) {
    //     this.$router.go(-1);//后退
    // },

     //回退事件
    onBack: function(isSuccess, json) {
        //this.$router.go(-1);//后退
        // this.curProps = [];
        this.onReset();
        this.$parent.setCurrentComponent("goBack",null);
    },

     // 审核记录
    onRecord: function(index, row) {

    },

     // 审核记录导出
    onExport: function(index, row) {

    },

     // 资产审核按钮单击事件
    onAudit: function(index, row) {

    },
    success: function(){
        this.isShowEditForm = false;
            this.$message({
                message: this.$i18n.t("message.successTip"),
                type: 'success'
        });
        this.queryTable();
    },

     // 查看详情按钮单击事件
    // onDetails: function(index, row) {

    //     //dataAccess.queryDomainModelByKeyID(this, modelName, "Query", row.keyID, true, this.$options.methods.editCallback);
    //     this.queryModelByKeyID(this.modelName,row.keyID,"Query",this.detailsCallback);
    // },

    onPlay: function(rescode){
      this.currentResCode = (rescode && rescode!=='') ? rescode : '';

    },
     //资产来源下拉列表数据
    findAssetSource: function(){
      var queryRequest = {
        className: "com.ispr.iptv.entity.sys.SpeArea",//修改为被查询的实体地址
        opKey: "Query",//后台编写相应的接口实现方法，主要负责转化类型
        params: [{key: 'isEnable',op: '=',val: 'Available'}],
        userInfo: this.getUserInfo()
      };
      var _this = this;
      this.axios.post('/api/query', queryRequest, {headers: this.headersObj})
      .then(function(res) {
      // alert(JSON.stringify(res));
      // alert(res.data.code);
        if (res.data.code == "SUCCESS") {
          _this.assetSourceData = [];
          for (var i = 0; i < res.data.data.length; i++) {
          _this.assetSourceData.push(res.data.data[i]);
          }
        } else {
        // this.$message.error(this.$i18n.t("errorCode." + json.reason,json.message));
        }
      })
      .catch(function(error) {
      console.log(error);
      // this.$message.error(this.$i18n.t("errorCode." + json.reason,json.message));
      });
    },

    //审核状态下拉列表数据
    findApprovalStatus: function(){
        this.findByTypeCode("10007",this.setApprovalCallback);
    },

    setApprovalCallback: function(isSuccess,json){
        try{
            if (isSuccess) {
                for (var i = 0; i < json.data.length; i++) {
                    this.approvalStatusData.push(json.data[i]);
                }
            }
            else {
                this.$message.error(json.msg);
            }
        }
        catch(e){
            alert(e);
        }
    },

    // // 详情按钮回调事件
    // detailsCallback: function(isSuccess,json) {
    //     if(isSuccess){
    //         this.curCommand = "UpdateProc";
    //         this.isShowInfoForm = true;
    //         if (this.$refs['editForm']) {
    //             this.$refs['editForm'].resetFields();
    //         }
    //         this.editForm.keyID = json.keyID;
    //         this.editForm.version = json.version;
    //         this.editForm.code = json.code;
    //         this.editForm.name = json.name;
    //         this.editForm.desc = json.desc;
    //         this.editForm.enName = json.enName;
    //         this.editForm.isEnabled = json.isEnabledVal;
    //         this.canEditCode = true;
    //     }
    //     else{
    //         this.$message({
    //             message: this.$i18n.t("errorCode." + json.reason,json.message),
    //             type: 'warning'
    //             });
    //     }
    // },
 // 查看详情按钮单击事件
    onDetails: function(index, row,rescode) {
        this.currentResCode = (rescode && rescode!=='') ? rescode : '';
        //dataAccess.queryDomainModelByKeyID(this, modelName, "Query", row.keyID, true, this.$options.methods.editCallback);
        this.queryModelByKeyID(this.modelName,row.keyId,"Query",this.detailsCallback);
        this.reviewQueryCondition.code.val = row.keyId;//剧集id
        this.reviewQueryCondition.type.val = "SUBASSET";
        this.reviewQueryCondition.assetName.val = row.subassetName;
    },
    changeBox: function(val) {
        this.multipleSelection = [];
        for (var i=0;i<val.length;i++){
            var keyId = val[i].keyId;
            var version = val[i].version;
            var data = {"keyId":keyId,"version":version};
            this.multipleSelection.push(data);
        }
    },

    checkboxInit: function(row,index){
        if (row.approvalStatusByQuery == 'PendingReview') {
            return true;
        }else{
            return false;
        }
    },

    // 详情按钮回调事件
    detailsCallback: function(isSuccess,json) {
        // console.log(json);
        if(isSuccess){
            this.curCommand = "UpdateProc";
            this.isShowInfoForm = true;
            if (this.$refs['dataForm']) {
                this.$refs['dataForm'].resetFields();
            }
            this.dataForm = json;
        }
        else{
            this.$message({
                message: json.msg,
                type: 'warning'
                });
        }
    },

    handleClick(tab, event) {
        if(tab.name=="second"){
            this.$refs.auditRecord.onQuery();
        }
    },
    renewRecord: function(){
        this.activeName = "first";
    },
    initTable:function(){
        this.tableHeight = this.$refs.context.offsetHeight - this.$refs.queryBox.offsetHeight;
        this.isInit = true;
    },
    enterDown(){
      var g = this
      if(g.isShowEditForm){
        g.submitFormForPass(g.currentResCode)
      }else if(g.isShowInfoForm){
        // 详情
        g.isShowInfoForm = false
      }else if(!g.loading){
        g.onQuery()
      }
    }

  },
  components:{
      "subAssets-info": subAssetsInfo,
      "audit-record": auditRecord,
  },
  computed: {

  },
  activated: function() {
     this.formQueryCondition.assetCode.val = this.curProps;
     this.onQuery();
  },
  mounted: function mounted() {
    this.findAssetSource();
    this.findApprovalStatus();
    // this.tableHeight = this.$refs.context.offsetHeight - this.$refs.queryBox.offsetHeight;
    // this.isInit = true;
    // alert(this.curProps[0].assetId);
    // this.onQuery();
    window.setTimeout(this.initTable,100);

  },
}


</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
